Ext.define('Admin.view.GridList', {
    extend: 'Ext.grid.Grid',
    // xtype is assigned by the tablet profile
    margin: '10px 0px 0px 10px',
    requires: [
        'Ext.grid.plugin.Editable',
        'Ext.grid.plugin.ViewOptions',
        'Ext.grid.plugin.PagingToolbar',
        'Ext.grid.plugin.SummaryRow',
        'Ext.grid.plugin.ColumnResizing',
        'Ext.grid.plugin.MultiSelection'
    ],
    controller: 'list',
    bind: {
        store: '{objs}'
    },
 
    itemConfig: {
        //viewModel: true,
        bind: {
            //userCls: 'inbox-{record.read:pick("unread","read")}'
        }
    },
	listeners: {
        itemdoubletap :'onDblClick',
        resize  : function(sender,info, eOpts) {
            var grid = Ext.getCmp(sender.id);
            var maxRowsPerGrid = Math.floor(grid.innerElement.getHeight()/Admin.Cfg.ROW_HEIGHT)-1;
            var st = grid.getStore();
    		if(st && st.getPageSize()!=maxRowsPerGrid){
                st.setPageSize(maxRowsPerGrid);
                st.load();
    		}
    	}
    },

    plugins: [ {
        type: 'pagingtoolbar'
    }, {
        type: 'columnresizing'
    }],
    rowLines: true,
    striped: true,
    loadingText:false,
    items:[ {
        xtype: 'toolbar',
        docked: 'top',
        scrollable: {
            y: false
        },
        items: [{
            xtype: 'button',
            margin: '0 10 0 20',
            text: 'Normal',
            menu: [{
                text: 'Menu Item'
            }]
        },{
            xtype: 'spacer'
        },{
            text: '录入',
            handler: 'onNew',
            ui: 'action'
        },{
            text: '克隆',
            handler: 'onClone',
            ui: 'action'
        },{
            text: '删除',
            ui: 'action',
            handler: 'onRemove'
        }]
    }]
});
